package com.pand.config;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

/**
 * Created by lh on 2017/11/8.
 */
@Configuration
public class DataSourceConfig {

    @Bean(name = "oracleDS")
    @Qualifier("oracleDS")
    @Primary
    @ConfigurationProperties(prefix="spring.oracle.datasource")
    public DataSource oracleDataSource(){
        return DataSourceBuilder.create().build();
    }

    @Bean(name = "mysqlDS")
    @Qualifier("mysqlDS")
    @ConfigurationProperties(prefix="spring.mysql.datasource")
    public DataSource mysqlDataSource(){
        return DataSourceBuilder.create().build();
    }

    @Bean(name = "trajectoryDS")
    @Qualifier("trajectoryDS")
    @ConfigurationProperties(prefix="spring.trajectory.datasource")
    public DataSource trajectoryDataSource(){
        return DataSourceBuilder.create().build();
    }
}
